<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/js/jquery-3.6.0.min.js"></script>
    <link href="../css/company.css" type="text/css" rel="stylesheet">
</head>
<body>
    <div th:include="common/inc"></div>
    <form class="elegant-aero">
        <input type="hidden" th:value="${position.positionId}" name="positionId">
        <h1>
            修改职位信息
        </h1>
        <label>
            <span>职位名称 :</span>
            <input id="positionName" type="text" name="positionName" th:value="${position.positionName}" />
        </label>
        <label>
            <span>职位职能 :</span>
            <input id="functions" type="text" name="functions" th:value="${position.functions}" />
        </label>
        <label>
            <span>职位信息 :</span>
            <textarea id="description" name="description" th:text="${position.description}"></textarea>
        </label>
        <label>
            <span>学历要求 :</span>
            <select name="degree">
                <option value="无">请选择</option>
                <option th:each="t:${degree}" th:value="${t.dataName}" th:text="${t.dataName}" th:selected="${t.dataName==position.degree}"></option>
            </select>
        </label>
        <label>
            <span>工作经验 :</span>
            <select name="experience">
                <option value="无">请选择</option>
                <option th:each="t:${experience}" th:value="${t.dataName}" th:text="${t.dataName}" th:selected="${t.dataName==position.experience}"></option>
            </select>
        </label>
        <label>
            <span>薪资范围 :</span>
            <select name="salary">
                <option value="无">请选择</option>
                <option th:each="t:${salary}" th:value="${t.dataName}" th:text="${t.dataName}" th:selected="${t.dataName==position.salary}"></option>
            </select>
        </label>
        <label>
            <span>&nbsp;</span>
            <input type="button" class="button" id="update" value="修改" onclick="updatePosition()">
        </label>
    </form>
<!--    <form class="form-inline">-->
<!--        <input type="hidden" th:value="${position.positionId}" name="positionId">-->
<!--        <table border="1">-->
<!--            <tr>-->
<!--                <td>职位信息</td>-->
<!--                <td>-->
<!--                    <input type="text" name="description" th:value="${position.description}" class="form-control">-->
<!--                </td>-->
<!--            </tr>-->
<!--            <tr>-->
<!--                <td>职位名称</td>-->
<!--                <td>-->
<!--                    <input type="text" name="positionName" th:value="${position.positionName}" class="form-control">-->
<!--                </td>-->
<!--            </tr>-->
<!--            <tr>-->
<!--                <td>职位职能</td>-->
<!--                <td>-->
<!--                    <input type="text" name="functions" th:value="${position.functions}" class="form-control">-->
<!--                </td>-->
<!--            </tr>-->
<!--            <tr>-->
<!--                <td>学历要求</td>-->
<!--                <td>-->
<!--                    <select class="form-control info-select"  name="degree" >-->
<!--                        <option value="无">请选择</option>-->
<!--                        <option th:each="t:${degree}" th:selected="${t.dataName==position.degree}" th:value="${t.dataName}" th:text="${t.dataName}"></option>-->
<!--                    </select>-->
<!--                </td>-->
<!--            </tr>-->
<!--            <tr>-->
<!--                <td>工作经验</td>-->
<!--                <td>-->
<!--                    <select class="form-control info-select"  name="experience" >-->
<!--                        <option value="无">请选择</option>-->
<!--                        <option th:each="t:${experience}" th:selected="${t.dataName==position.experience}" th:value="${t.dataName}" th:text="${t.dataName}"></option>-->
<!--                    </select>-->
<!--                </td>-->
<!--            </tr>-->
<!--            <tr>-->
<!--                <td>薪资范围</td>-->
<!--                <td>-->
<!--                    <select class="form-control info-select"  name="salary" >-->
<!--                        <option value="无">请选择</option>-->
<!--                        <option th:each="t:${salary}" th:selected="${t.dataName==position.salary}" th:value="${t.dataName}" th:text="${t.dataName}"></option>-->
<!--                    </select>-->
<!--                </td>-->
<!--            </tr>-->
<!--            <tr>-->
<!--                <td colspan="2">-->
<!--                    <input type="button" value="修改" onclick="updatePosition()" class="btn-success">-->
<!--                </td>-->
<!--            </tr>-->
<!--        </table>-->
<!--    </form>-->

</body>

<script>
    //修改职位
    function updatePosition(){
        $.ajax({
            url:"/position/updatePosition",
            type:"post",
            data:$("form").serialize(),
            success:function (){
                alert("修改成功");
                location.href="/position/position";//跳转
            },error:function () {
                alert("修改失败");
            }
        })
    }
</script>

</html>